﻿package control
{
    import com.core.*;
    import flash.utils.*;
    import view.*;

    public class GuideControl extends Control
    {
        private var alltips:Dictionary;
        private var currentTips:Object;
        private var curdata:Object;
        private var _cfgGuide:Object;

        public function GuideControl(param1:Object)
        {
            this.alltips = new Dictionary();
            super(param1);
            return;
        }// end function

        override public function update(param1:Obproxy, param2:ProxyChange) : void
        {
            var _loc_3:int = 0;
            if (param1.getName() == "guide")
            {
                if (param2.property == "show")
                {
                    this.target.show(param2.newvalue);
                }
                else if (param2.property == "hide")
                {
                    if (param2.newvalue == 0)
                    {
                        this.target.hide(false);
                    }
                    else if (GuideView.getInstance().gid == param2.newvalue)
                    {
                        this.target.hide();
                    }
                }
                else if (param2.property == "stagehide")
                {
                    _loc_3 = GuideView.getInstance().gid;
                    if (_loc_3 > 0 && GuideView.getInstance().visible)
                    {
                        if (this._cfgGuide == null)
                        {
                            this._cfgGuide = ConfigDictionary.data.newguide;
                        }
                        if (this._cfgGuide[_loc_3] && this._cfgGuide[_loc_3].type == 4)
                        {
                            this.target.hide();
                        }
                    }
                }
                else if (param2.property == "doguide")
                {
                    this.target.doGuide(param2.newvalue);
                }
                else if (param2.property == "doguide1")
                {
                    this.target.doGuide1(param2.newvalue.id, param2.newvalue.str);
                }
                else if (param2.property == "setguide")
                {
                    this.target.setGuide(param2.newvalue);
                }
                else if (param2.property == "checklvguide")
                {
                    this.target.checkLvGuide(param2.newvalue);
                }
                else if (param2.property == "addguide")
                {
                    this.target.addGuide(param2.newvalue);
                }
                else if (param2.property == "initguide")
                {
                    this.target.initGuide();
                }
                else if (param2.property == "initguidetask")
                {
                    this.target.initGuideTask();
                }
                else if (param2.property == "dotaskguide")
                {
                    this.target.doTaskGuide(param2.newvalue.taskid, param2.newvalue.guideid);
                }
                else if (param2.property == "showbtn")
                {
                    this.target.showBtn(param2.newvalue.dir, param2.newvalue.obj);
                }
                else if (param2.property == "setvisible")
                {
                    this.target.changeVisible(param2.newvalue.lv, param2.newvalue.guide);
                }
            }
            else if (param1.getName() == "guidepao")
            {
                if (param2.property == "hide")
                {
                    if (GuideViewPao.getInstance().gid == param2.newvalue || param2.newvalue == 0)
                    {
                        this.target.hide();
                    }
                }
            }
            return;
        }// end function

    }
}
